package net.kazed.nextaction.toplevel.activity;

import net.kazed.nextaction.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Displays a list of the help activities.
 */
public class HelpActivity extends ListActivity {
    private static final int WELCOME = 0;
    private static final int ABOUT = WELCOME + 1;
    
	@Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
    }
	
	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        return true;
    }

	@Override
	protected void onResume() {
		super.onResume();

        String[] perspectives = new String[] {
                        getResources().getString(R.string.help_contents),
                        getResources().getString(R.string.help_about)
        };
        
        ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.list_item_view,
              R.id.name, perspectives);
        setListAdapter(adapter);
	}

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return super.onOptionsItemSelected(item);
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
      switch (position) {
      case WELCOME:
         startActivity(new Intent(this, HelpContentsActivity.class));
         break;
      case ABOUT:
         startActivity(new Intent(this, AboutActivity.class));
         break;
      }
    }

}
